//
//  SSLSocketManager.h
//  SSLSocket
//
//  Created by 恒达的mini on 2017/6/10.
//  Copyright © 2017年 孙世龙. All rights reserved.
/*
 1、如果报错Undefined symbols for architecture arm64: "_OBJC_CLASS_$_GCDAsyncSocket"
    需要把GCDAsyncSocket.m和GCDAsyncUdpSocket.m加入到compile sources
 2、保持tag值一致
 3、加入重连机制，连续请求超过10次停止链接
 4、加入心跳机制，保持长连接，发送的字段可以与服务器协商自行修改
5、服务端下载地址socket地址链接: http://pan.baidu.com/s/1jIC8fau 密码: mx1f
 注意：
 加入3个系统库：Security、Foundation、CFNetwork
 
 */


#import <Foundation/Foundation.h>

enum{
    SocketOffLineByServer = 0,     //服务器原因断开，需要重连
    SocketOffLineByUser = 1        //用户主动断开，不需要重连
};//socket断开方式

@protocol SSLSocketManagerDelegate <NSObject>

- (void)outputMessage:(NSString*)msg;//返回状态及消息

@end

@interface SSLSocketManager : NSObject

@property (nonatomic,assign) id<SSLSocketManagerDelegate>delegate;
@property (nonatomic,  copy) NSString        *socketHost;  //服务器地址
@property (nonatomic,assign) UInt16           socketPort;  //端口
@property (nonatomic,retain) NSTimer       *connectTimer;  //心跳计时器
@property (nonatomic)        BOOL       openHeartConnect;  //是否打开心跳
/*单例*/
+ (instancetype)sharedInstance;
/*链接*/
- (BOOL)tcpSocketConnect;
/*关闭*/
- (void)tcpSocketCutOff;
/*发送*/
- (void)tcpSocketSendInfo:(NSString *)info;

@end

